# name : SAS Returns the position and length of a substring that matches a pattern, and iterates over multiple matches within one string., pattern, regex
# key : prxnext.iteratively
# key : regex.prxposn.iteratively
# contributor: Shuguang Sun
# --
${1:_patternid} = prxparse(${10:'/foo(bar)/'});
${2:_start} = 1;
${3:_stop} = length(${4:invar});
call prxnext($1, $2, $3, $4, ${5:_position}, ${6:_length});
do while ($5 > 0);
  ${7:_fd_tmp} = substr($4, $5, $6);
  ${8:_fd_pos} = prxmatch($1, $7);
  ${9:outvar} = prxposn($1, 1, $7);
  put $7\$quote. $5 $6 $8 $9:\$quote.;
  output;
  call prxnext($1, $2, $3, $4, $5, $6);
  end;
